﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using octopus_project.input;
using Microsoft.Xna.Framework.Input;
using octopus_project.enumeration;
using octopus_project.tileset;
using octopus_project.scene;
using octopus_project.scene.cannon.weapon;
using octopus_project.screen;

namespace octopus_project.scene.cannon {
    class Cannon_Cursor : Cursor_GameplayEntry {

        private Weapon currentWeapon;

        public Cannon_Cursor (GameScreen gameScreen, Player ownerPlayer)
            : base(gameScreen, ownerPlayer) {

                currentWeapon = ownerPlayer.Stats.nextWeapon();
        }


        public override void Update () {
        }
        
        /// <summary>
        /// Description.
        /// </summary>
        public override void Draw() {
            if (currentWeapon != null) {
            
                spriteBatch.Begin();
                for (byte x = 0; x < currentWeapon.Dimension.GetLength(0); x++) {
                    for (byte y = 0; y < currentWeapon.Dimension.GetLength(1); y++) {
                        if (currentWeapon.Dimension[x, y] != 0) {
                            spriteBatch.Draw(
                                TileTypeExtensions.SpriteImage,
                                new Rectangle((PositionX + x) * Constant.TILE_SIDE, (PositionY + y) * Constant.TILE_SIDE, Constant.TILE_SIDE, Constant.TILE_SIDE),
                                ((TileType)currentWeapon.Dimension[x, y]).GetSourceRectangle(),
                                Color.White);
                        }
                    }
                }
                spriteBatch.End();
            }
        }

        public Weapon CurrentWeapon {
            get { return currentWeapon; }
            set { currentWeapon = value; }
        }

        
    }


}
